Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We should remove wasinn feature flag in plugin.rs #78

Open
CaptainVincent opened this issue Oct 19, 2023 · 2 comments
Open

We should remove wasinn feature flag in plugin.rs #78

CaptainVincent opened this issue Oct 19, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@CaptainVincent
Copy link
Member

Designing plugins to be dynamically loaded. Introducing feature flag make functionality is statically determined.
Consider using a macro-like approach to dynamic generate the relevant preload API.

@apepkuss apepkuss added the enhancement New feature or request label Oct 20, 2023
@apepkuss
Copy link
Collaborator

In the plugin mod (namely plugin.rs), the wasi_nn feature works as a switch to enable/disable the nn_preload API and the relevant types. The motivation of this design is from the C-API WasmEdge_PluginInitWASINN. As the description of the C-API, it is used to initialize the wasi_nn plug-in, implicitly meaning that it is only available when wasi_nn is enabled. Therefore, for the cases of the wasi_nn plugin being not present, the nn_preload API should not be present; when the wasi_nn plugin is required, users should explicitly enable the wasi_nn feature so that they can use the wasi_nn related APIs, such as the nn_preload API.

@CaptainVincent
Copy link
Member Author

I'm wondering if support for wasi_nn should be dynamically determined?
This is because it only makes sense when the plugin loader detects .so files related to wasi_nn.
If it's solely determined by the rust feature flag but without a corresponding plugin library, it's still not meaningful.
Is it feasible to optimize this by generating functions through macros only when the .so files are found?
However, to be honest, I'm not sure about the complexity of this modification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants